GBML manual / Using the editor

The Inspector - looking inside a playing game

See every object, variable and global of your game while it plays; pause it, step one frame, change a value, and watch what you care about.

What it is for

When something in your game is not right, the quickest answer is usually to look at what the game is holding while it plays: is the enemy where you think it is, is that number going up, did that alarm ever start? The Inspector is a tab in the build window (beside Build and Search; next to the game in the Play tab there is also a Player movement tab, with the numbers of the Player movement designer, and each one you change is played at once; everything in the Inspector window starts folded) that shows exactly that, live, while the game runs. It never changes your game's files, and a game built with the Inspector in mind is byte for byte the same game.

Turning it on

Press Build & Play. The game opens in the Play tab, and the build window moves to the right edge, beside the game, with the Inspector already selected and filled in. You can fold it down to its title bar with its arrow (Gbabel remembers), and it shows even if you hid the compile window in the View menu. Leave the Play tab and the window goes back to where it was (minimized, after Build & Play). You can drag its left edge to make it wider or narrower, and pick Build or Search instead (Gbabel remembers that for the Play tab).

It works with development builds (what Build & Play makes; see Development Build and Release Build). A release build still plays - the tab just says it needs a development build.

With Quick Play

Quick Play plays your game without building it, and the Inspector and the Player movement tab work beside it too: the objects and their variables, the globals, Pause and Step, every row of the live sections (Camera, Lighting, Animation speed, Game feel, Effect strength, Sound, Parallax, Particles and the background color of each world region) and the Player movement numbers with Keep these. A change you make is played at once. Two sections need a real console and say Needs a built game: Busiest so far (how long a frame takes) and Background layers (the screen's layers as a console holds them); only a built game shows them. Build and Log are not shown beside a Quick Play game, because nothing is built.

In an emulator program instead

If Play inside Gbabel is off, the game opens in your emulator program. Then tick Open the game with the Inspector (in the Inspector tab) before you press Build & Play; it works with the mGBA emulator, and another emulator still plays the game - the tab just says why it cannot look inside. Only one game can be looked at at a time.

What you see

WhereWhat it shows
Top stripThe room, the camera's position, the frame number, how many frames a second the game really runs (about 60 on a console; not shown while the game is held), the song, a running cutscene and its step, and how many particle effects are running.
ObjectsONE section holding every object that has a copy alive ("21 alive"). Open it:
Each objectInside it, a drawer named for the object, with how many copies are alive out of how many it can have. Only objects with at least one copy alive are listed, the one with the most alive first (equal counts keep your project's order). A drawer appears with the first copy and goes when the last one does; if it was open it comes back open.
Each copyA closed row: the object's name and its number on the left, and its x and y in two columns on the right. Open it for every variable, with its value and kind.
AlarmsInside an open copy, each alarm that is counting down and how many frames it has left.
Busiest so farA row for each room the game has shown: the slowest frame it needed there as a percent of one frame (over 100% the game missed frames), and the deepest stack its calls went, in bytes, out of what the console keeps for them. Explained below.
GlobalsEvery global the game has.
Background layersEach of the screen's background layers is a drawer: showing or hidden, how far in front, how far moved. Open one to see a picture of the layer as the screen holds it now (with a box where the screen is looking), its colors and size.

An open copy lists the variables you made, and the built-in ones (x, y, speed, direction, depth, visible, sprite, frame ...). A value that points at another object shows that object's name and number; click it to jump to it. A sprite, song or font shows its name.

Busiest so far

Always on while a development build plays in the Play tab: there is no button and no mode. The section lists every room the game has shown since it started, in the order it showed them, with two figures each:

The figures only go up while the game plays; stop the game and play again to start them over. The room the game is in now says (here).

When the game stops, Gbabel keeps the deepest stack in your project by itself. A figure measured on an older version of the game is replaced by this one; a figure for this version only ever goes up. The next build uses it to decide whether the game still fits in the console's memory, so it knows more the more of your game you play. Release builds carry none of this.

It costs the game nothing while it plays: Gbabel reads the figures from the game's memory between two frames, twice a second, whether or not the Inspector is showing. (The game itself notes its slowest frame once a frame, and looks at its stack once each time the room changes.)

Camera

The Camera section (a game playing in the Play tab, development builds) shows the camera of the game you are playing and lets you change it while you watch. Its rows are the same as the Camera settings of a room in the Room Editor: Follows, Stops at edges, Ease (tick Ease up/down separately for a second slider), Dead zone width and height, Look-ahead distance and speed, and Offset across and down. Move a row and the game changes at once: drag Ease to the left and the view trails behind the player, drag it to its last notch and it has no lag at all; give it a dead zone and the player can walk about inside the box while the view stays still.

If the game's own code sets the camera (it follows something, or sets a dead zone), the rows show what the code set, and they follow when the code changes it.

When the camera feels right, press Apply to the room. The settings the game has now are saved as the Camera settings of the room (or the world) the game is in, as one step you can undo, and the line under the button says which room that was. The game you are playing is not changed by saving; the next time that room starts it begins with those settings. A change you made in the section but did not apply is gone when the game stops. While the game is paused, a change waits and shows up when the game plays again.

Lighting

The Lighting section (a game playing in the Play tab, development builds) lets you try the room's darkness and how far each light reaches while you watch. Darkness is the same slider as in Room Properties (0 is barely dimmed, 100 is almost black; it only does something in a room that is Shrouded), and each light of the game has a Reach row, the same slider and number as in the light's Adjust window. Drag Darkness and the whole room gets darker or brighter at once; make a light's Reach longer and it lights more of the room.

A light whose own code sets its size every step (a flame that flares, say) keeps doing that: the code wins, and the row shows what the game does.

When it looks right, press Apply to the project. The Darkness you set is saved into the room (or the world) the game is in, and each Reach you changed is saved into that light's object, as one step you can undo. Only what you changed in the section is saved, and the number you asked for, never a number the game's own code was moving. The game you are playing is not changed by saving; build it again to play it from the start.

Animation speed

The Animation speed section (a game playing in the Play tab, development builds) lists the animations of the game, each under its object, with the same Speed field as in the Animations window (100 is as drawn, 200 twice as fast, 50 half as fast, from 10 to 400). Change a speed and the game plays that animation at the new speed at once, so you can find the speed that feels right while you watch it. When the list is long, type in the box at the top to find an animation by name.

Press Apply to the project and each speed you changed is saved as that animation's Speed, as one step you can undo. Only what you changed in the section is saved. The game you are playing is not changed by saving; build it again to play it from the start. (The speed of an animated tile in a tileset cannot be changed this way yet.)

Pause, step and resume

Pause holds the game at the start of its next frame, so every number you read belongs to one moment. Step one frame plays exactly one frame and holds again - the frame number goes up by one, and so does everything the game does in one frame. Resume plays on. While the game plays, a look can show two numbers from two neighboring moments, so pause when you need to be sure. For a game in the Play tab these are the Play tab's own buttons: pause it with either, and both show it.

Changing a value

Click a value, type, press Enter: the game takes the new value at once. A yes/no is a tick box; a named choice is a list. The Inspector refuses what cannot work, in plain words - letters in a whole number, a number too big for the game, text longer than the variable holds, a copy that is no longer alive - and changes nothing. Esc gives up. References to other objects, sprites, songs and lists cannot be changed here.

Flashing, watching and finding

Tick Highlight changes and a value that changed since the last look is softly highlighted for a moment. The star beside any variable or global puts it in a Watching list at the top (and the list is kept for the project). Find an object narrows the list to objects whose name has the letters you type, and also finds an object with none alive, marked none alive.

What it costs the game

Looking does not stop the game. In the Play tab the Inspector reads the game's memory between two frames about ten times a second, a few hundred bytes each time; measured on a 60-frames-a-second game, the game runs at the same speed with the Inspector looking as without - even when it looks thousands of times a second. In an emulator program it asks the emulator a few small questions about five times a second, with the same result. Pausing and changing a value stop the game for the moment they take.

Limits

See also: Building and reading its problemsDevelopment Build and Release BuildThe Code tabPlaying your game inside Gbabel